Skip to main content

MBR

Smallest rectangle that fully encloses a region of interest, providing a bounding box with minimal area.

🎭 Mask options and parameters of getMbr method
🔎 ROI options and parameters of mbr accessor

Minimum Bounding Rectangle(MBR) is the smallest rectangle which can fit the region of interest in question.

MBR output

MBR is relevant for such things as extracting features, detecting collisions or simply localizing objects.

In ImageJS minimum bounding rectangle is a ROI class accessor that returns a Mbr object.

Property nameDescriptionProperty type
pointspoints that form MBRPoint[]
perimeterMBR's perimeternumber
surfaceMBR's surfacenumber
heightMBR's heightnumber
widthMBR's widthnumber
angleMBR's anglenumber
aspectRatioratio between MBR's width and heightnumber
const mbr = roi.mbr;

It can also be a Mask method to calculate its mbr:

const mbr = mask.getMbr();
Implementation

Here's how Minimum Bounding Rectangle is calculated in ImageJS:

Finding convex hull:an algorithm is based on the fact that one of the MBR sides is aligned with one of the convex hull sides.

Rotating an object: an object gets rotated parallel to the X-axis. It allows finding tilt angles of the diameters. It also facilitates calculation of the points. After all the data is found, it just gets rotated back by the same angle to get actual result.

Finding extremities: since the object is rotated, it means that vertical lines will be perpendicular to the hull side in question. Therefore, for each side, algorithm finds extremities which in turn calculate into points, width and surface.